package com.yida.gwj.expend.outside.enums;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;

import java.util.List;

/**
 * 附件材料信息
 *
 * @author wkz
 */
public enum BusinessAttachmentServerTypeEnum {
    /**
     * 附件材料信息
     */
    APPLICATION_REPORT(1, "申请报告", "《申请报告》【纸质材料】"),
    PROJECT_BUDGET(2, "工程预算书", "《工程预算书》(设备类的为背面有业主签字确认的报价单；工程类的为经第三方造价机构审核的预算书)【纸质材料】"),
    OWNER_COMMENTS(3, "业主征求意见材料", "《业主征求意见材料》：含有业主签字意见的《维修和更新、改造方案》（方案内第五条分摊方式中，专有部分的业主才可参与分摊，同样楼栋不需要参与分摊需写明原因；第六条转入账户必须为对公账户）【纸质材料】"),
    TRANSFORMATION_PLAN(4, "维修和更新、改造方案", "《维修和更新、改造方案》（业主联系电话要与业主签字一致，不可放空）【纸质材料】"),
    OWNER_CONFIRMATION_CERTIFICATE(5, "业主确认证明", "《业主确认证明》(产权人相同的合并为一户来计算户数比例)【纸质材料】"),
    PUBLICITY_PHOTOS(6, "公示照片", "《公示照片》(申请单位应将《报价单》及《维修和更新、改造方案》在小区各楼幢（梯）显著位置进行公示，公示照片含张贴位置的远照、可看清内容的近照及拍照日期。公示期10天以上，公示期前后各一份)【纸质材料】"),
    PUBLIC_CERTIFICATION(7, "公示证明", "《公示证明》【纸质材料】"),
    APPLICANT_MATERIALS(8, "申请人主体资格材料", "《申请人主体资格材料》（业委会申请的需要提供业委会备案证明复印件（加盖公章），物业公司提供物业服务合同复印件（加盖公章）及《物业合同备案证明》）【纸质材料】"),
    MAINTENANCE_CONTRACT(9, "维修合同", "《维修合同》【纸质材料】"),
    ADVANCE_PAYMENT_RECEIPT(10, "维修资金预付款收款收据", "《维修资金预付款收款收据》（维修资金预付款同等数额的正式普通发票复印件（两份）加盖申请单位公章及开具给主管单位的收款收据（如需拨付预付款才提供））【纸质材料】"),
    ACCOUNT_MAINTENANCE_WORKS(11, "维修工程决算书", "《维修工程决算书》【纸质材料】"),
    SETTLEMENT_INVOICE_RECEIPT(12, "维修资金结算发票收款收据", "《维修资金结算发票收款收据》【纸质材料】"),
    APPLICATION_APPROPRIATE_REPORT(13, "申请拨付报告", "《申请拨付报告》"),
    FINAL_COST_ALLOCATION_LIST(14, "决算费用分摊清册", "《决算费用分摊清册》【纸质材料】"),
    ACCEPTANCE_REPORT(15, "验收报告", "《验收报告》【纸质材料】"),
    APPLICATION_APPROVAL(16, "申请报批表", "《申请报批表》"),
    APPROPRIATE_EXAMINE(17, "使用拨付审批表", "《使用拨付审批表》"),
    PROOF_NECESSITY(18, "维修必要性证明", "《维修必要性证明》"),
    INSPECTION_CONFIRMATION(19, "现场勘验确认表", "《现场勘验确认表》"),
    DETAILS_PROJECT_BUDGET_ALLOCATION(20, "维修工程预算分摊明细表", "《维修工程预算分摊明细表》"),
    OTHER(100, "其他材料", "《其他材料》【纸质材料】");

    private final Integer code;
    private final String info;
    private final String remark;

    BusinessAttachmentServerTypeEnum(Integer code, String info, String remark) {
        this.code = code;
        this.info = info;
        this.remark = remark;
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public String getRemark() {
        return remark;
    }

    /**
     * @return
     */
    public static BusinessAttachmentServerTypeEnum translate(Integer code) {
        for (BusinessAttachmentServerTypeEnum value : BusinessAttachmentServerTypeEnum.values()) {
            if (ObjectUtil.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }

    /**
     * 资金申请列表
     *
     * @return
     */
    public static List<BusinessAttachmentServerTypeEnum> getServerTypeList() {
        return ListUtil.toList(BusinessAttachmentServerTypeEnum.APPLICATION_REPORT,
                BusinessAttachmentServerTypeEnum.PROJECT_BUDGET,
                //  BusinessAttachmentServerTypeEnum.OWNER_COMMENTS,
                BusinessAttachmentServerTypeEnum.TRANSFORMATION_PLAN,
                // BusinessAttachmentServerTypeEnum.OWNER_CONFIRMATION_CERTIFICATE,
                BusinessAttachmentServerTypeEnum.PUBLICITY_PHOTOS,
                BusinessAttachmentServerTypeEnum.APPLICANT_MATERIALS,
                BusinessAttachmentServerTypeEnum.MAINTENANCE_CONTRACT,
                BusinessAttachmentServerTypeEnum.ADVANCE_PAYMENT_RECEIPT
        );
    }

    /**
     * 资金拨付申请列表
     *
     * @return
     */
    public static List<BusinessAttachmentServerTypeEnum> getAppropriateServerTypeList() {
        return ListUtil.toList(BusinessAttachmentServerTypeEnum.ACCOUNT_MAINTENANCE_WORKS,
                BusinessAttachmentServerTypeEnum.PUBLICITY_PHOTOS,
                BusinessAttachmentServerTypeEnum.SETTLEMENT_INVOICE_RECEIPT,
                BusinessAttachmentServerTypeEnum.APPLICATION_APPROPRIATE_REPORT,
                BusinessAttachmentServerTypeEnum.FINAL_COST_ALLOCATION_LIST,
                BusinessAttachmentServerTypeEnum.ACCEPTANCE_REPORT);
    }

    /**
     * 应急资金申请列表
     *
     * @return
     */
    public static List<BusinessAttachmentServerTypeEnum> getUrgentServerTypeList() {
        return ListUtil.toList(BusinessAttachmentServerTypeEnum.APPLICATION_REPORT,
                BusinessAttachmentServerTypeEnum.PROJECT_BUDGET,
                BusinessAttachmentServerTypeEnum.TRANSFORMATION_PLAN,
                BusinessAttachmentServerTypeEnum.DETAILS_PROJECT_BUDGET_ALLOCATION,
                BusinessAttachmentServerTypeEnum.PROOF_NECESSITY,
                BusinessAttachmentServerTypeEnum.INSPECTION_CONFIRMATION,
                BusinessAttachmentServerTypeEnum.PUBLICITY_PHOTOS,
                BusinessAttachmentServerTypeEnum.APPLICANT_MATERIALS,
                BusinessAttachmentServerTypeEnum.MAINTENANCE_CONTRACT,
                BusinessAttachmentServerTypeEnum.ADVANCE_PAYMENT_RECEIPT);
    }

    /**
     * 应急资金拨付申请列表
     *
     * @return
     */
    public static List<BusinessAttachmentServerTypeEnum> getUrgentAppropriateServerTypeList() {
        return ListUtil.toList(BusinessAttachmentServerTypeEnum.ACCOUNT_MAINTENANCE_WORKS,
                BusinessAttachmentServerTypeEnum.PUBLICITY_PHOTOS,
                BusinessAttachmentServerTypeEnum.SETTLEMENT_INVOICE_RECEIPT,
                BusinessAttachmentServerTypeEnum.APPLICATION_APPROPRIATE_REPORT,
                BusinessAttachmentServerTypeEnum.FINAL_COST_ALLOCATION_LIST,
                BusinessAttachmentServerTypeEnum.ACCEPTANCE_REPORT);
    }
    
 // -------------------------临时新增功能 s---------------------------

    /**
     * 根据编码返回指定类型参数
     * 
     * @param code 编码
     * @param type 0=info;1=remark 否则返回info:remark
     * @return
     */
    public static String getEnumVuale(Integer code, Integer type) {
        BusinessAttachmentServerTypeEnum[] basteArray = values();
        for (BusinessAttachmentServerTypeEnum baste : basteArray) {
            if (baste.getCode() == code) {
                if (0 == type) {
                    return baste.getInfo();
                }
                if (1 == type) {
                    return baste.getRemark();
                }
                return baste.getInfo() + ":" + baste.getRemark();
            }
        }
        return null;
    }
    // -------------------------临时新增功能 e---------------------------
}
